package com.fzq.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * minion配置类
 */
@Configuration
@Data
@ConfigurationProperties(prefix = "minio")
public class MinIoConfig {
    private static String endpoint = "http://127.0.0.1:9000";
    private static String accesskey = "Sx8ra0RbKYLf1l0vmFqX";
    private static String secretKey = "hTPqZxlxeRcZu35rYOl0IMpEua0A6GqXECd3BzZU";

    /**
     * 创建MinioClient对象
     * @return
     * @throws Exception
     */
    @Bean
    public MinioClient minioClient() throws Exception {
        return MinioClient.builder().endpoint(endpoint)
                .credentials(accesskey, secretKey).build();
    }
}
